package com.hongx.plugin;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;

import com.hongx.pluginstand.PayInterfaceActivity;


/**
 * @author: fuchenming
 * @create: 2019-08-09 08:36
 */
public class BaseActivity2 extends Activity implements PayInterfaceActivity {

    protected Activity that;
    protected Context context;
    protected Handler m_myHandler = new Handler();

    @Override
    public void onCreate(Bundle saveInstanceState) {
        super.onCreate(saveInstanceState);
        context= this;

        Log.e("p_ba===onCreate", "===" + that);


//        setContentView(R.layout.activity_main2);
    }

    @Override
    public void setContentView(View view) {
        Log.e("ba===setContentView", view+"==="+that);

        if(that != null){
            that.setContentView(view);
        }else{
            super.setContentView(view);
        }
    }

    @Override
    public void setContentView(int layoutResID) {
        Log.e("p_ba===setContentView2", layoutResID+"==="+that);

        if(that != null){
            that.setContentView(layoutResID);
        }else{
            super.setContentView(layoutResID);
        }
    }

    @Override
    public void attach(Activity proxyActivity) {
        Log.e("p_ba===attach", proxyActivity+"==="+that);

        this.that = proxyActivity;
    }

    @Override
    public <T extends View> T findViewById(int id) {
        Log.e("p_ba===findViewById", id+"==="+that);

        if(that != null){
            return that.findViewById(id);
        }else{
            return super.findViewById(id);
        }
    }


//    @Override
//    public void startActivity(Intent intent) {
//        Intent m  = new Intent();
//        m.putExtra("className",intent.getComponent().getClassName());
//        that.startActivity(m);
//    }



    @Override
    public void finish() {
        that.finish();
    }

    public void onBackPressed() {
        that.onBackPressed();
    }

    @Override
    public void onStart() {
        super.onStart();
    }

    @Override
    public void onResume() {
        super.onResume();
    }

    @Override
    public void onPause() {
        super.onPause();
    }

    @Override
    public void onStop() {
        super.onStop();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {

    }



}
